import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:hygf/view/image_picker_widget.dart';

import '../../../../bean/CustomerList.dart';
import '../../../../bean/add_construct_bean.dart';
import '../../../../util/format_util.dart';

class ConstructMsgState {
  bool isReadOnly = true;
  ConstructionLink constructionLink = ConstructionLink();
  AddConstructBean addConstructBean = AddConstructBean();
  TextEditingController startDateController = TextEditingController();
  TextEditingController endDateController = TextEditingController();
  TextEditingController constructionUserController = TextEditingController();
  TextEditingController locationController = TextEditingController();
  TextEditingController rnTimeController = TextEditingController();
  TextEditingController safetyUserController = TextEditingController();
  TextEditingController codeController = TextEditingController();
  TextEditingController entranceDateController = TextEditingController();
  TextEditingController reMarkController = TextEditingController();
  ImagePickerWidgetController mEntrancePhotoController =
      ImagePickerWidgetController();
  ImagePickerWidgetController classMeetingPhotoController =
      ImagePickerWidgetController();
  ImagePickerWidgetController safetyProtectionPhotoController =
      ImagePickerWidgetController();
  ImagePickerWidgetController stentInstallPhotoController =
      ImagePickerWidgetController();
  ImagePickerWidgetController componentInstallPhotoController =
      ImagePickerWidgetController();
  ImagePickerWidgetController rnOtherImgController =
      ImagePickerWidgetController();
  ImagePickerWidgetController inverterInstallGroundController =
      ImagePickerWidgetController();
  ImagePickerWidgetController inverterInstallPhotoController =
      ImagePickerWidgetController();
  ImagePickerWidgetController stentInstallGroundController =
      ImagePickerWidgetController();
  ImagePickerWidgetController cableLayingPhotoController =
      ImagePickerWidgetController();
  ImagePickerWidgetController componentFinishPhotoController =
      ImagePickerWidgetController();
  ImagePickerWidgetController voltagePhotoController =
      ImagePickerWidgetController();
  ImagePickerWidgetController resistancePhotoController =
      ImagePickerWidgetController();
  ImagePickerWidgetController inverterPhotoController =
      ImagePickerWidgetController();

  ConstructMsgState() {
    var map = Get.arguments;
    if (map["pageData"] != null) {
      CustomerListItem itemData = map["pageData"];
      constructionLink.customerInfoId = itemData.id;
      if (itemData.status == 15) {
        constructionLink.startDate = FormatUtil.formatTime(DateTime.now());
        constructionLink.endDate = FormatUtil.formatTime(DateTime.now());
        constructionLink.materialsEntranceDate =
            FormatUtil.formatTime(DateTime.now());
        isReadOnly = false;
      }
      if (itemData.status == 16 || itemData.status == 18) {
        isReadOnly = false;
      }
    }
    if (map["title"] != null) {
      if (map["title"] == "客户详情") {
        isReadOnly = true;
      }
    }
  }
}
